Repository navigation
Answer a failed transcoded call with a JSON body - #397
Draft
zZHorizonZz wants to merge 1 commit into
Draft
zZHorizonZz wants to merge 1 commit into
zZHorizonZz wants to merge 1 commit into
Conversation
zZHorizonZz
marked this pull request as draft
November 27, 2026 12:23
Member
Author
|
Depends on #393. |
Motivation: A transcoded call that fails before the response head is written answers Content-Type: application/json with an empty body, which is not JSON. A server stream that fails after writing its head, or whose message cannot be transcoded, sets the status code too late and the call never ends. Changes: - GrpcTranscodingError.end answers a response with the error's HTTP status and google.rpc.Status as JSON: code, message and details. details is empty. - Before the head is written, a failed call is answered with GrpcTranscodingError.end. After it, a stream ends as before and the status is in the grpc-status trailer. - A unary message that cannot be transcoded answers INTERNAL with a body, and the call is not ended a second time. - A streaming message that cannot be transcoded fails its write. - HttpGrpcOutboundStream keeps the status message next to the status. - Tests for unary and streaming errors, with and without a status message, for a StatusException thrown by the handler, for a stream that fails after its head, and for messages that cannot be transcoded.
zZHorizonZz
force-pushed
the
transcoding-error-body
branch
from
December 1, 2026 09:16
e0f8186 to
efeb276
Compare
vietj
approved these changes
Dec 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #395
Motivation:
A transcoded call that fails before the response head is written returns
Content-Type: application/jsonwith an empty body. A server stream that fails after writing its head, or sends a message that can't be transcoded, never ends.Changes:
google.rpc.StatusJSON body (code,message,details).detailsis empty since transcoding has no type registry to print them.grpc-statustrailer.INTERNALwith a body.HttpGrpcOutboundStreamkeeps the status message.StatusExceptionfrom the handler, a stream failing after its head, and messages that can't be transcoded.